﻿using System;
using System.ComponentModel.DataAnnotations;
using BLL.CustomAttribute;
using BLL.Enum;
using BLL.Model.User;

namespace BLL.Model.Apply
{
    public class ApplyProcess
    {
        public ApplyProcess()
        {
            ApprovalDate = DateTime.Now;
        }

        [Key, StringProperty]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }

        [Display(Name = "审批日期"), Required, DisplayFormat(DataFormatString = "{0:yyyy/MM/dd}")]
        public DateTime ApprovalDate { get; set; }

        [Display(Name = "审批意见"), StringLength(2000), Required(AllowEmptyStrings = false)]
        public string ApprovalComment { get; set; }

        [Required]
        public int StatusValue { get; set; }

        [NotMapped, Display(Name = "审批状态")]
        public ApplyProcessStatus Status
        {
            get { return (ApplyProcessStatus)StatusValue; }
            set { StatusValue = (int)value; }
        }

        [Required]
        public int ApprovalUserId { get; set; }

        [Display(Name = "审批人"), ForeignKey("ApprovalUserId")]
        public virtual UserInfo ApprovalUser { get; set; }

    }
}